﻿#pragma once

#include "../../Server/MirDatabase/CharacterInfo.h"
#include <string>
#include <any>
#include "../../stringhelper.h"

using namespace Server::MirDatabase;
using namespace Server::MirObjects;

namespace Server
{
    class PlayerInfoForm : public System::Windows::Forms::Form
    {
    private:
        CharacterInfo *Character = nullptr;

    public:
        virtual ~PlayerInfoForm()
        {
            delete Character;
            delete components;
            delete label1;
            delete label2;
            delete label3;
            delete NameTextBox;
            delete IndexTextBox;
            delete LevelTextBox;
            delete UpdateButton;
            delete KickButton;
            delete SendMessageTextBox;
            delete SendMessageButton;
            delete groupBox1;
            delete groupBox2;
            delete groupBox3;
            delete KillButton;
            delete CurrentMapLabel;
            delete label5;
            delete KillPetsButton;
            delete label4;
            delete PKPointsLabel;
            delete label6;
            delete OnlineTimeLabel;
            delete label7;
            delete GoldLabel;
            delete label8;
            delete CurrentIPLabel;
            delete groupBox4;
            delete ChatBanButton;
            delete ChatBanExpiryTextBox;
            delete label9;
            delete SafeZoneButton;
            delete OpenAccountButton;
        }

        PlayerInfoForm();

        PlayerInfoForm(unsigned int playerId);

    private:
        void UpdatePlayerInfo();

        void UpdateButton_Click(std::any sender, EventArgs *e);

        void SaveChanges();

        void SendMessageButton_Click(std::any sender, EventArgs *e);

        void KickButton_Click(std::any sender, EventArgs *e);

        void KillButton_Click(std::any sender, EventArgs *e);

        void KillPetsButton_Click(std::any sender, EventArgs *e);
        void SafeZoneButton_Click(std::any sender, EventArgs *e);

        void ChatBanButton_Click(std::any sender, EventArgs *e);

        void ChatBanExpiryTextBox_TextChanged(std::any sender, EventArgs *e);

        void OpenAccountButton_Click(std::any sender, EventArgs *e);



        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::IContainer *components = nullptr;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected:
        void Dispose(bool disposing) override;

        #pragma region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
    private:
        void InitializeComponent();

        #pragma endregion

        System::Windows::Forms::Label *label1;
        System::Windows::Forms::Label *label2;
        System::Windows::Forms::Label *label3;
        System::Windows::Forms::TextBox *NameTextBox;
        System::Windows::Forms::TextBox *IndexTextBox;
        System::Windows::Forms::TextBox *LevelTextBox;
        System::Windows::Forms::Button *UpdateButton;
        System::Windows::Forms::Button *KickButton;
        System::Windows::Forms::TextBox *SendMessageTextBox;
        System::Windows::Forms::Button *SendMessageButton;
        System::Windows::Forms::GroupBox *groupBox1;
        System::Windows::Forms::GroupBox *groupBox2;
        System::Windows::Forms::GroupBox *groupBox3;
        System::Windows::Forms::Button *KillButton;
        System::Windows::Forms::Label *CurrentMapLabel;
        System::Windows::Forms::Label *label5;
        System::Windows::Forms::Button *KillPetsButton;
        System::Windows::Forms::Label *label4;
        System::Windows::Forms::Label *PKPointsLabel;
        System::Windows::Forms::Label *label6;
        System::Windows::Forms::Label *OnlineTimeLabel;
        System::Windows::Forms::Label *label7;
        System::Windows::Forms::Label *GoldLabel;
        System::Windows::Forms::Label *label8;
        System::Windows::Forms::Label *CurrentIPLabel;
        System::Windows::Forms::GroupBox *groupBox4;
        System::Windows::Forms::Button *ChatBanButton;
        System::Windows::Forms::TextBox *ChatBanExpiryTextBox;
        System::Windows::Forms::Label *label9;
        System::Windows::Forms::Button *SafeZoneButton;
        System::Windows::Forms::Button *OpenAccountButton;
    };
}
